package com.jandan.ui.client;

import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.layout.VerticalLayout;

public class LinkPanel extends Panel {
	private ILessonOperator lessonOperator;
	public LinkPanel(ILessonOperator lessonOperator){
		this.lessonOperator = lessonOperator;
		this.setLayout(new VerticalLayout(2));
		this.setCls("link-panel");
		this.setPaddings(5, 5, 0, 0);
		this.createComponent();		
	}
	
	public LinkPanel(){
		this.setLayout(new VerticalLayout(2));
		this.setCls("link-panel");
		this.setBorder(true);
		
		this.setWidth(200);
		this.createComponent();
	}
	
	private void createComponent(){

		Hyperlink createNewLessonLink = new Hyperlink("创建新课程",true,"");
		createNewLessonLink.addStyleName("right-bar-links");
				
		createNewLessonLink.addClickListener(new ClickListener(){
			public void onClick(Widget arg0) {
				// TODO Auto-generated method stub
				LessonWindow window = new LessonWindow(lessonOperator);//ClientUtil.COMMON_LESSON);
				window.show();
			}
		});
		
		this.add(createNewLessonLink);
		
		Hyperlink addStrangeWordLink = new Hyperlink("添加生词",true,"");
		addStrangeWordLink.addStyleName("right-bar-links");

		addStrangeWordLink.addClickListener(new ClickListener(){
			public void onClick(Widget arg0) {
				// TODO Auto-generated method stub
				lessonOperator.addStrangeWord();
			}
		});
		
		this.add(addStrangeWordLink);
		
		Hyperlink checkStrangeWordLink = new Hyperlink("查看生词本",true,"");
		checkStrangeWordLink.addStyleName("right-bar-links");
		
		checkStrangeWordLink.addClickListener(new ClickListener(){
			public void onClick(Widget arg0) {
				// TODO Auto-generated method stub
				lessonOperator.browseStrangeWord();
			}
		});
		
		this.add(checkStrangeWordLink);
	}
}
